package translinkApp.DialogBoxes.WebsiteLinks;

import translinkApp.Utilities.Utils;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;

public class WebsiteLinksDialog extends Builder {

	public WebsiteLinksDialog(final Context context) {
		super(context);

		final WebSiteInfoList webSitesList = new WebSiteInfoList(
				"http://mobile.translink.com.au/");
		webSitesList.add(new WebSiteInfo("travel-information/service-updates", "Service Status"));
		webSitesList.add(new WebSiteInfo("travel-information/services-and-timetables/search", "Timetables"));
		webSitesList.add(new WebSiteInfo("tickets-and-fares/go-card/locations", "Go card Locations"));
		webSitesList.add(new WebSiteInfo("travel-information/services-and-timetables/event-transport", "Events"));
		webSitesList.add(new WebSiteInfo("tickets-and-fares", "Tickets and Fares"));
		webSitesList.add(new WebSiteInfo("site-information/contact-us-and-help", "Contact Translink"));

		final CharSequence[] webSites = webSitesList.getDialogList();

		setTitle("Select a link");

		setItems(webSites, new DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface dialog, int item) {

				WebSiteInfo selectedItem = webSitesList.get(item);

				Utils.openUrl(context, webSitesList.getUriStart() + selectedItem.getUri());

			}
		});

	}
}